package edu.hcmiu.portal.model;

import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
import com.liferay.portal.kernel.util.HtmlUtil;
import com.liferay.portal.model.impl.BaseModelImpl;

import java.io.Serializable;

import java.lang.reflect.Proxy;


public class hook_userClp extends BaseModelImpl<hook_user> implements hook_user {
    private long _userID;
    private String _userName;
    private String _userEmail;

    public hook_userClp() {
    }

    public long getPrimaryKey() {
        return _userID;
    }

    public void setPrimaryKey(long pk) {
        setUserID(pk);
    }

    public Serializable getPrimaryKeyObj() {
        return new Long(_userID);
    }

    public long getUserID() {
        return _userID;
    }

    public void setUserID(long userID) {
        _userID = userID;
    }

    public String getUserName() {
        return _userName;
    }

    public void setUserName(String userName) {
        _userName = userName;
    }

    public String getUserEmail() {
        return _userEmail;
    }

    public void setUserEmail(String userEmail) {
        _userEmail = userEmail;
    }

    public hook_user toEscapedModel() {
        if (isEscapedModel()) {
            return this;
        } else {
            hook_user model = new hook_userClp();

            model.setEscapedModel(true);

            model.setUserID(getUserID());
            model.setUserName(HtmlUtil.escape(getUserName()));
            model.setUserEmail(HtmlUtil.escape(getUserEmail()));

            model = (hook_user) Proxy.newProxyInstance(hook_user.class.getClassLoader(),
                    new Class[] { hook_user.class },
                    new ReadOnlyBeanHandler(model));

            return model;
        }
    }

    public Object clone() {
        hook_userClp clone = new hook_userClp();

        clone.setUserID(getUserID());
        clone.setUserName(getUserName());
        clone.setUserEmail(getUserEmail());

        return clone;
    }

    public int compareTo(hook_user hook_user) {
        long pk = hook_user.getPrimaryKey();

        if (getPrimaryKey() < pk) {
            return -1;
        } else if (getPrimaryKey() > pk) {
            return 1;
        } else {
            return 0;
        }
    }

    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }

        hook_userClp hook_user = null;

        try {
            hook_user = (hook_userClp) obj;
        } catch (ClassCastException cce) {
            return false;
        }

        long pk = hook_user.getPrimaryKey();

        if (getPrimaryKey() == pk) {
            return true;
        } else {
            return false;
        }
    }

    public int hashCode() {
        return (int) getPrimaryKey();
    }

    public String toString() {
        StringBuilder sb = new StringBuilder();

        sb.append("{userID=");
        sb.append(getUserID());
        sb.append(", userName=");
        sb.append(getUserName());
        sb.append(", userEmail=");
        sb.append(getUserEmail());
        sb.append("}");

        return sb.toString();
    }

    public String toXmlString() {
        StringBuilder sb = new StringBuilder();

        sb.append("<model><model-name>");
        sb.append("edu.hcmiu.portal.model.hook_user");
        sb.append("</model-name>");

        sb.append(
            "<column><column-name>userID</column-name><column-value><![CDATA[");
        sb.append(getUserID());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>userName</column-name><column-value><![CDATA[");
        sb.append(getUserName());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>userEmail</column-name><column-value><![CDATA[");
        sb.append(getUserEmail());
        sb.append("]]></column-value></column>");

        sb.append("</model>");

        return sb.toString();
    }
}
